import request from '@/utils/request.js'

//商品列表
export function fetchProductList(params){
    return request({
        url:'product_list',
        method:'get',
        params:params
    })
}

//商品分类
export function fetchProductAttrList(params){
    return request({
        url:'get_product_attr',
        method:'get',
        params:params
    })
}
//商品类型
export function fetchProductcateList(params,parent_id){
    return request({
        url:"get_product_category_list/"+parent_id,
        method:'get',
        params:params

    })
}
//品牌列表
export function fetchbrandList(params){
    return request({
        url:'get_product_brand_pag',
        method:'get',
        params:params

    })
}

//品牌搜索功能
export function fetchBrand (params){
     return request({
        url:'get_product_brand',
        method:'get',
        params:params

    })
}

//商品分类
export function spfl (params){
      return request({
        url:'get_product_category',
        method:'get',
        params:params

    })
}
//修改商品分类
export function xgspfl (params){
      return request({
        url:'update_product_cate',
        method:'get',
        params:params

    })
}
//删除商品分类
export function scspfl (params){
      return request({
        url:'delete_category',
        method:'get',
        params:params

    })
}

//添加商品接口
export function tianjia1 (data){
      return request({
        url:'create_product',
        method:'post',
        data:data

    })
}

//添加商品分类接口
export function createProductCate (data){
      return request({
        url:'create_product_cate',
        method:'post',
        data:data

    })
}
//修改商品信息
//http://www.yinruifang.cn/index/Api/update_product
export function updateProduct(data) {
    return request({
        url: "update_product",
        method: "post",
        data: data
    })
}

//通过id获取一条商品记录
//url 地址：http://www.yinruifang.cn/index/Api/product_one
export function getProductOne(params) {
    return request({
        url: "product_one",
        method: "get",
        params: params
    })
}
//删除
export function delProduct(params) {
    return request({
        url: "delete_status",
        method: "get",
        params: params
    })
}

//添加商品类型
export function tjfl1(params) {
    return request({
        url: "create_product_attr",
        method: "get",
        params: params
    })
}
//修改商品分类
export function xiugaifl(data) {
    return request({
        url: "update_product_cate",
        method:"post",
        params: data
    })
}
//通过id获取一条商品分类记录
//url 地址：http://www.yinruifang.cn/index/Api/product_one
export function getProductOne2(params) {
    return request({
        url: "product_cate_one",
        method: "get",
        params: params
    })
}
//删除商品类型
export function shanchulx(params) {
    return request({
        url: "delete_product_attr",
        method: "get",
        params: params
    })
}

export function xglx2(params) {
    return request({
        url: "create_product_attr",
        method: "get",
        params: params
    })
}